package com.lgx.authorize.util;

import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

/**
 *  this is date charger for date format.
 * @author pengdeyi
 *
 */
public final class DateCharger {
	
	public static String chargeTime(Date date) {
		String str = "";
		if (date != null) {
			str = DateFormat.getDateTimeInstance().format(date);
		}
		return str;
	}
	
	public static Date chargeDate(String str) throws ParseException{
		Date date = null;
		if(StringUtils.isNotBlank(str)){
			date = DateFormat.getDateTimeInstance().parse(str);
		}
		return date;
	}
	
}
